package com.bjtech.web.action.management;

import com.bjtech.dao.StandardSinkParamDao;
import com.bjtech.domain.StandardSinkParam;
import com.bjtech.domain.query.StandardSinkParamQuerySpec;
import com.bjtech.web.action.LyheatBaseAction;

public class StandardSinkParamAction extends LyheatBaseAction {

	private static final long serialVersionUID = 1L;
	private StandardSinkParamDao standardSinkParamDao;
	private StandardSinkParamQuerySpec selectBean;
	
	public void prepare() throws Exception {

	}
	
	public StandardSinkParamAction() throws Exception{
		model = new StandardSinkParam();
		selectBean = new StandardSinkParamQuerySpec();
	}
	
	public void setStandardSinkParamDao(StandardSinkParamDao standardSinkParamDao) {
		this.standardSinkParamDao = standardSinkParamDao;
	}

	public String execute(){
		return this.list();
	}
	
	public String list(){
		selectBean.queryParamString();
		list = this.standardSinkParamDao.selectEntityPaginatedList(new StandardSinkParam(),selectBean);
		return "list";
	}
	
	public String add(){
		return "edit";
	}
	
	public String save(){
		StandardSinkParam entity = (StandardSinkParam)model;
		if(entity.getId()==null){
			standardSinkParamDao.insertEntity(entity);
		}else{
			standardSinkParamDao.updateEntity(entity);
		}
		return this.list();
	}
	
	public String edit(){
		model = this.standardSinkParamDao.selectEntity(new StandardSinkParam(),id);
		return "edit";
	}

	public String view(){
		model = this.standardSinkParamDao.selectEntity(new StandardSinkParam(),id);
		return "view";
	}
	
	public String delete(){
		model = this.standardSinkParamDao.deleteEntity(new StandardSinkParam(),id);
		return this.list();
	}
	
	public StandardSinkParamQuerySpec getSelectBean() {
		return selectBean;
	}

	public void setSelectBean(StandardSinkParamQuerySpec selectBean) {
		this.selectBean = selectBean;
	}
}
